<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body{
            margin: 0;
            background-color: black;
        }
        img{
            position: absolute;
        }
    </style>
</head>
<body>
<!--引入jQuery框架-->
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script>
    setInterval(function () {
        let img = $("<img src='snow.png'>")
        $("body").append(img);

        //得到20~40的随机大小
        let size = parseInt(Math.random()*21)+20;
        img.css("width",size+"px");

        let w = $(window).width();
        let left = parseInt(Math.random()*(w-size));
        img.css("left",left+"px");

        let top = $(window).height()-size;
        img.animate({"top":top+"px"},size*100)
            .fadeOut(1000,function () {
                img.remove();
            });
    },10)
</script>
</body>
</html>